import numpy as np
 
a = np.zeros((3, 2), dtype=int) 
Count = np.zeros(3, dtype=int) 
a[0, :] = [1, 2]
a[1, :] = [1, 3]
a[2, :] = [2, 2]
Img_size = 24
 
for ii in range(3):
    rec_h = a[ii, 0]
    rec_w = a[ii, 1]
    for xx in range(rec_h, Img_size+1, rec_h):
        for yy in range(rec_w, Img_size+1, rec_w):
            Count[ii] = Count[ii]+(Img_size-xx+1)*(Img_size-yy+1)

print("图像大小: ({},{})".format(Img_size, Img_size))
print("二矩形特征: {}*2".format(Count[0]))
print("三矩形特征: {}*2".format(Count[1]))
print("四矩形特征: {}".format(Count[2]))
Total = Count[0]*2+Count[1]*2+Count[2]
print ("Total: ", Total)